package com.demo.okhttp;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;

public class OkHttpGetDemo {
    public static void main(String[] args) throws IOException {
        String url = "http://gadmin-pp.weimipopo.com/user/login";
        //1 创建okHttpClient
        OkHttpClient okHttpClient = new OkHttpClient();
        //2 构建request请求
        Request request = new Request.Builder().url(url)
                .get()
                .build();
        //3 使用client 发送请求 返回一个响应
        Response response = okHttpClient.newCall(request).execute();
        System.out.println(response.code());
        System.out.println(response.headers());
        System.out.println(response.body().toString());

    }
}
